/**
 *  @param {string} url 地址后缀
 *  @param {any} data 请求参数
 */
export function requsetGet(url, data) {
	return requset(url, 'GET', data);
}

function requset(url, method, data) {
	const suffix = url.indexOf('/') != -1 ? `/${url}` : url;
	let prefix = `https://qiche.zjysdb.com/prod-api` + suffix;
	// let prefix = `https://qiche.zjysdb.com/dev-api` + suffix;
	return new Promise((resolve, reject) => {
		uni.request({
			url: prefix,
			method,
			data,
			success(res) {
				resolve(res.data);
			},
			fail(err) {
				reject(err.errMsg)
			}
		})
	})
}